namespace QMVnSoft.Opening
{
    using QMVnSoft;
    using QMVnSoft.Controls;
    using QMVnSoft.DAL;
    using System;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Windows.Forms;

    public class FormCDKHOEditor : FormOpenningEditor
    {
        private IContainer components;
        private LabelControl lblDo_Am_PT;
        private LabelControl lblDo_Con_PT;
        private LabelControl lblDvt;
        private LabelControl lblH_Luong;
        private LabelControl lblHan_Dung;
        private LabelControl lblLo_Hang;
        private LabelControl lblMa_Ke;
        private LabelControl lblMa_Kho;
        private LabelControl lblMa_Vt;
        private LabelControl lblNgay_Ct;
        private LabelControl lblSo_Luong;
        private TextNumeric txtDo_Am_PT;
        private TextNumeric txtDo_Con_PT;
        private TextOption txtDvt;
        private TextControl txtDvt0;
        private TextNumeric txtH_Luong;
        private TextDate txtHan_Dung;
        private TextControl txtLo_Hang;
        private TextSearch txtMa_Ke;
        private TextSearch txtMa_Kho;
        private TextSearch txtMa_Vt;
        private TextDate txtNgay_Ct;
        private TextNumeric txtSo_Luong;
        private TextNumeric txtSo_Luong9;
        private TextControl txtTen_Ke;
        private TextControl txtTen_Kho;
        private TextControl txtTen_Vt;

        public FormCDKHOEditor()
        {
            this.InitializeComponent();
            if (!AppInstance.LocationCtrl)
            {
                this.lblMa_Ke.Visible = false;
                this.txtMa_Ke.Visible = false;
                this.txtTen_Ke.Visible = false;
                this.lblMa_Kho.Top = this.lblMa_Ke.Top;
                this.txtMa_Kho.Top = this.txtMa_Ke.Top;
                this.txtTen_Kho.Top = this.txtTen_Ke.Top;
            }
            if (!AppInstance.LotNumberCtrl)
            {
                this.lblLo_Hang.Visible = false;
                this.txtLo_Hang.Visible = false;
            }
            if (!AppInstance.DeadLineCtrl)
            {
                this.lblHan_Dung.Visible = false;
                this.txtHan_Dung.Visible = false;
            }
            if (!AppInstance.QualityCtrl)
            {
                this.lblH_Luong.Visible = false;
                this.txtH_Luong.Visible = false;
            }
            if (!AppInstance.DampCtrl)
            {
                this.lblDo_Am_PT.Visible = false;
                this.txtDo_Am_PT.Visible = false;
            }
            if (!AppInstance.AlcoholCtrl)
            {
                this.lblDo_Con_PT.Visible = false;
                this.txtDo_Con_PT.Visible = false;
            }
        }

        private void Calculate()
        {
            this.SetItemRatio();
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        private void InitializeComponent()
        {
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormCDKHOEditor));
            this.txtTen_Vt = new QMVnSoft.Controls.TextControl();
            this.txtTen_Kho = new QMVnSoft.Controls.TextControl();
            this.txtMa_Vt = new QMVnSoft.Controls.TextSearch();
            this.lblMa_Vt = new QMVnSoft.Controls.LabelControl();
            this.txtMa_Kho = new QMVnSoft.Controls.TextSearch();
            this.lblMa_Kho = new QMVnSoft.Controls.LabelControl();
            this.lblDvt = new QMVnSoft.Controls.LabelControl();
            this.txtSo_Luong9 = new QMVnSoft.Controls.TextNumeric();
            this.lblSo_Luong = new QMVnSoft.Controls.LabelControl();
            this.txtSo_Luong = new QMVnSoft.Controls.TextNumeric();
            this.lblNgay_Ct = new QMVnSoft.Controls.LabelControl();
            this.txtNgay_Ct = new QMVnSoft.Controls.TextDate();
            this.lblH_Luong = new QMVnSoft.Controls.LabelControl();
            this.lblDo_Am_PT = new QMVnSoft.Controls.LabelControl();
            this.lblDo_Con_PT = new QMVnSoft.Controls.LabelControl();
            this.txtH_Luong = new QMVnSoft.Controls.TextNumeric();
            this.txtDo_Am_PT = new QMVnSoft.Controls.TextNumeric();
            this.txtDo_Con_PT = new QMVnSoft.Controls.TextNumeric();
            this.txtDvt = new QMVnSoft.Controls.TextOption();
            this.txtLo_Hang = new QMVnSoft.Controls.TextControl();
            this.lblHan_Dung = new QMVnSoft.Controls.LabelControl();
            this.txtHan_Dung = new QMVnSoft.Controls.TextDate();
            this.lblLo_Hang = new QMVnSoft.Controls.LabelControl();
            this.txtDvt0 = new QMVnSoft.Controls.TextControl();
            this.lblMa_Ke = new QMVnSoft.Controls.LabelControl();
            this.txtMa_Ke = new QMVnSoft.Controls.TextSearch();
            this.txtTen_Ke = new QMVnSoft.Controls.TextControl();
            this.SuspendLayout();
            // 
            // txtTen_Vt
            // 
            this.txtTen_Vt.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.txtTen_Vt.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(194)))), ((int)(((byte)(217)))), ((int)(((byte)(247)))));
            this.txtTen_Vt.BorderStyle = System.Windows.Forms.BorderStyle.None;
            this.txtTen_Vt.CheckTextSearched = false;
            this.txtTen_Vt.DisabledForeColor = System.Drawing.Color.Blue;
            this.txtTen_Vt.Enabled = false;
            this.txtTen_Vt.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtTen_Vt.ForeColor = System.Drawing.Color.Blue;
            this.txtTen_Vt.Location = new System.Drawing.Point(301, 73);
            this.txtTen_Vt.Name = "txtTen_Vt";
            this.txtTen_Vt.OldValue = null;
            this.txtTen_Vt.Size = new System.Drawing.Size(287, 13);
            this.txtTen_Vt.TabIndex = 79;
            this.txtTen_Vt.UserTextLength  = QMVnSoft.AppInstance.TextControlLength.None;
            this.txtTen_Vt.UserTrimMode  = QMVnSoft.AppInstance.TextControlTrimMode.Right;
            this.txtTen_Vt.Value = ((object)(resources.GetObject("txtTen_Vt.Value")));
            // 
            // txtTen_Kho
            // 
            this.txtTen_Kho.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.txtTen_Kho.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(194)))), ((int)(((byte)(217)))), ((int)(((byte)(247)))));
            this.txtTen_Kho.BorderStyle = System.Windows.Forms.BorderStyle.None;
            this.txtTen_Kho.CheckTextSearched = false;
            this.txtTen_Kho.DisabledForeColor = System.Drawing.Color.Blue;
            this.txtTen_Kho.Enabled = false;
            this.txtTen_Kho.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtTen_Kho.ForeColor = System.Drawing.Color.Blue;
            this.txtTen_Kho.Location = new System.Drawing.Point(301, 31);
            this.txtTen_Kho.Name = "txtTen_Kho";
            this.txtTen_Kho.OldValue = null;
            this.txtTen_Kho.Size = new System.Drawing.Size(287, 13);
            this.txtTen_Kho.TabIndex = 80;
            this.txtTen_Kho.UserTextLength  = QMVnSoft.AppInstance.TextControlLength.None;
            this.txtTen_Kho.UserTrimMode  = QMVnSoft.AppInstance.TextControlTrimMode.Right;
            this.txtTen_Kho.Value = ((object)(resources.GetObject("txtTen_Kho.Value")));
            // 
            // txtMa_Vt
            // 
            this.txtMa_Vt.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
            this.txtMa_Vt.CheckTextSearched = false;
            this.txtMa_Vt.DisabledForeColor = System.Drawing.Color.Empty;
            this.txtMa_Vt.FieldDisplay = "Ten_Vt";
            this.txtMa_Vt.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtMa_Vt.Location = new System.Drawing.Point(133, 70);
            this.txtMa_Vt.MaxLength = 32;
            this.txtMa_Vt.Name = "txtMa_Vt";
            this.txtMa_Vt.OldValue = null;
            this.txtMa_Vt.Size = new System.Drawing.Size(162, 20);
            this.txtMa_Vt.TabIndex = 2;
            this.txtMa_Vt.TableName = "DMVT";
            this.txtMa_Vt.TextDisplay = this.txtTen_Vt;
            this.txtMa_Vt.UserTextLength  = QMVnSoft.AppInstance.TextControlLength.ItemCode;
            this.txtMa_Vt.UserTrimMode  = QMVnSoft.AppInstance.TextControlTrimMode.All;
            this.txtMa_Vt.Value = ((object)(resources.GetObject("txtMa_Vt.Value")));
            this.txtMa_Vt.Validated += new System.EventHandler(this.txtMa_Vt_Validated);
            // 
            // lblMa_Vt
            // 
            this.lblMa_Vt.AutoSize = true;
            this.lblMa_Vt.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblMa_Vt.Location = new System.Drawing.Point(12, 73);
            this.lblMa_Vt.Name = "lblMa_Vt";
            this.lblMa_Vt.Size = new System.Drawing.Size(88, 14);
            this.lblMa_Vt.TabIndex = 77;
            this.lblMa_Vt.Text = "Vật tư, hàng hóa";
            // 
            // txtMa_Kho
            // 
            this.txtMa_Kho.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
            this.txtMa_Kho.CheckTextSearched = false;
            this.txtMa_Kho.DisabledForeColor = System.Drawing.Color.Empty;
            this.txtMa_Kho.FieldDisplay = "Ten_Kho";
            this.txtMa_Kho.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtMa_Kho.Location = new System.Drawing.Point(133, 28);
            this.txtMa_Kho.MaxLength = 32;
            this.txtMa_Kho.Name = "txtMa_Kho";
            this.txtMa_Kho.OldValue = null;
            this.txtMa_Kho.Size = new System.Drawing.Size(162, 20);
            this.txtMa_Kho.TabIndex = 0;
            this.txtMa_Kho.TableName = "DMKHO";
            this.txtMa_Kho.TextDisplay = this.txtTen_Kho;
            this.txtMa_Kho.UserTextLength  = QMVnSoft.AppInstance.TextControlLength.ItemCode;
            this.txtMa_Kho.UserTrimMode  = QMVnSoft.AppInstance.TextControlTrimMode.All;
            this.txtMa_Kho.Value = ((object)(resources.GetObject("txtMa_Kho.Value")));
            // 
            // lblMa_Kho
            // 
            this.lblMa_Kho.AutoSize = true;
            this.lblMa_Kho.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblMa_Kho.Location = new System.Drawing.Point(12, 31);
            this.lblMa_Kho.Name = "lblMa_Kho";
            this.lblMa_Kho.Size = new System.Drawing.Size(41, 14);
            this.lblMa_Kho.TabIndex = 78;
            this.lblMa_Kho.Text = "Mã kho";
            // 
            // lblDvt
            // 
            this.lblDvt.AutoSize = true;
            this.lblDvt.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblDvt.Location = new System.Drawing.Point(12, 94);
            this.lblDvt.Name = "lblDvt";
            this.lblDvt.Size = new System.Drawing.Size(59, 14);
            this.lblDvt.TabIndex = 86;
            this.lblDvt.Text = "Đơn vị tính";
            // 
            // txtSo_Luong9
            // 
            this.txtSo_Luong9.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtSo_Luong9.Location = new System.Drawing.Point(184, 91);
            this.txtSo_Luong9.Name = "txtSo_Luong9";
            this.txtSo_Luong9.NumericValue = new decimal(new int[] {
            0,
            0,
            0,
            0});
            this.txtSo_Luong9.OldValue = null;
            this.txtSo_Luong9.Size = new System.Drawing.Size(111, 20);
            this.txtSo_Luong9.TabIndex = 4;
            this.txtSo_Luong9.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
            this.txtSo_Luong9.UserTextNumericFormat  = QMVnSoft.AppInstance.TextNumericFormat.Quantity;
            this.txtSo_Luong9.Value = ((object)(resources.GetObject("txtSo_Luong9.Value")));
            this.txtSo_Luong9.Validated += new System.EventHandler(this.txtSo_Luong9_Validated);
            // 
            // lblSo_Luong
            // 
            this.lblSo_Luong.AutoSize = true;
            this.lblSo_Luong.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblSo_Luong.Location = new System.Drawing.Point(12, 115);
            this.lblSo_Luong.Name = "lblSo_Luong";
            this.lblSo_Luong.Size = new System.Drawing.Size(51, 14);
            this.lblSo_Luong.TabIndex = 86;
            this.lblSo_Luong.Text = "Số lượng";
            // 
            // txtSo_Luong
            // 
            this.txtSo_Luong.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtSo_Luong.Location = new System.Drawing.Point(133, 112);
            this.txtSo_Luong.Name = "txtSo_Luong";
            this.txtSo_Luong.NumericValue = new decimal(new int[] {
            0,
            0,
            0,
            0});
            this.txtSo_Luong.OldValue = null;
            this.txtSo_Luong.ReadOnly = true;
            this.txtSo_Luong.Size = new System.Drawing.Size(162, 20);
            this.txtSo_Luong.TabIndex = 5;
            this.txtSo_Luong.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
            this.txtSo_Luong.UserTextNumericFormat  = QMVnSoft.AppInstance.TextNumericFormat.Quantity;
            this.txtSo_Luong.Value = ((object)(resources.GetObject("txtSo_Luong.Value")));
            // 
            // lblNgay_Ct
            // 
            this.lblNgay_Ct.AutoSize = true;
            this.lblNgay_Ct.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblNgay_Ct.Location = new System.Drawing.Point(12, 136);
            this.lblNgay_Ct.Name = "lblNgay_Ct";
            this.lblNgay_Ct.Size = new System.Drawing.Size(32, 14);
            this.lblNgay_Ct.TabIndex = 1;
            this.lblNgay_Ct.Text = "Ngày";
            // 
            // txtNgay_Ct
            // 
            this.txtNgay_Ct.DateTimeFormat  = QMVnSoft.Controls.TextDate.DateTimeFormatType.Date;
            this.txtNgay_Ct.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtNgay_Ct.InsertKeyMode = System.Windows.Forms.InsertKeyMode.Overwrite;
            this.txtNgay_Ct.Location = new System.Drawing.Point(133, 133);
            this.txtNgay_Ct.Mask = "00/00/0000";
            this.txtNgay_Ct.Name = "txtNgay_Ct";
            this.txtNgay_Ct.OldValue = null;
            this.txtNgay_Ct.Size = new System.Drawing.Size(162, 20);
            this.txtNgay_Ct.TabIndex = 6;
            this.txtNgay_Ct.Value = ((object)(resources.GetObject("txtNgay_Ct.Value")));
            // 
            // lblH_Luong
            // 
            this.lblH_Luong.AutoSize = true;
            this.lblH_Luong.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblH_Luong.Location = new System.Drawing.Point(383, 136);
            this.lblH_Luong.Name = "lblH_Luong";
            this.lblH_Luong.Size = new System.Drawing.Size(59, 14);
            this.lblH_Luong.TabIndex = 86;
            this.lblH_Luong.Text = "Hàm lượng";
            // 
            // lblDo_Am_PT
            // 
            this.lblDo_Am_PT.AutoSize = true;
            this.lblDo_Am_PT.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblDo_Am_PT.Location = new System.Drawing.Point(383, 157);
            this.lblDo_Am_PT.Name = "lblDo_Am_PT";
            this.lblDo_Am_PT.Size = new System.Drawing.Size(38, 14);
            this.lblDo_Am_PT.TabIndex = 86;
            this.lblDo_Am_PT.Text = "Độ ẩm";
            // 
            // lblDo_Con_PT
            // 
            this.lblDo_Con_PT.AutoSize = true;
            this.lblDo_Con_PT.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblDo_Con_PT.Location = new System.Drawing.Point(383, 178);
            this.lblDo_Con_PT.Name = "lblDo_Con_PT";
            this.lblDo_Con_PT.Size = new System.Drawing.Size(42, 14);
            this.lblDo_Con_PT.TabIndex = 86;
            this.lblDo_Con_PT.Text = "Độ cồn";
            // 
            // txtH_Luong
            // 
            this.txtH_Luong.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtH_Luong.Location = new System.Drawing.Point(448, 133);
            this.txtH_Luong.Name = "txtH_Luong";
            this.txtH_Luong.NumericValue = new decimal(new int[] {
            0,
            0,
            0,
            0});
            this.txtH_Luong.OldValue = null;
            this.txtH_Luong.Size = new System.Drawing.Size(140, 20);
            this.txtH_Luong.TabIndex = 9;
            this.txtH_Luong.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
            this.txtH_Luong.UserTextNumericFormat  = QMVnSoft.AppInstance.TextNumericFormat.Percent;
            this.txtH_Luong.Value = ((object)(resources.GetObject("txtH_Luong.Value")));
            // 
            // txtDo_Am_PT
            // 
            this.txtDo_Am_PT.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtDo_Am_PT.Location = new System.Drawing.Point(448, 154);
            this.txtDo_Am_PT.Name = "txtDo_Am_PT";
            this.txtDo_Am_PT.NumericValue = new decimal(new int[] {
            0,
            0,
            0,
            0});
            this.txtDo_Am_PT.OldValue = null;
            this.txtDo_Am_PT.Size = new System.Drawing.Size(140, 20);
            this.txtDo_Am_PT.TabIndex = 10;
            this.txtDo_Am_PT.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
            this.txtDo_Am_PT.UserTextNumericFormat  = QMVnSoft.AppInstance.TextNumericFormat.Percent;
            this.txtDo_Am_PT.Value = ((object)(resources.GetObject("txtDo_Am_PT.Value")));
            // 
            // txtDo_Con_PT
            // 
            this.txtDo_Con_PT.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtDo_Con_PT.Location = new System.Drawing.Point(448, 175);
            this.txtDo_Con_PT.Name = "txtDo_Con_PT";
            this.txtDo_Con_PT.NumericValue = new decimal(new int[] {
            0,
            0,
            0,
            0});
            this.txtDo_Con_PT.OldValue = null;
            this.txtDo_Con_PT.Size = new System.Drawing.Size(140, 20);
            this.txtDo_Con_PT.TabIndex = 11;
            this.txtDo_Con_PT.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
            this.txtDo_Con_PT.UserTextNumericFormat  = QMVnSoft.AppInstance.TextNumericFormat.Percent;
            this.txtDo_Con_PT.Value = ((object)(resources.GetObject("txtDo_Con_PT.Value")));
            // 
            // txtDvt
            // 
            this.txtDvt.CheckTextSearched = false;
            this.txtDvt.DisabledForeColor = System.Drawing.Color.Blue;
            this.txtDvt.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtDvt.InputMask = "";
            this.txtDvt.Location = new System.Drawing.Point(133, 91);
            this.txtDvt.Name = "txtDvt";
            this.txtDvt.OldValue = null;
            this.txtDvt.Size = new System.Drawing.Size(50, 20);
            this.txtDvt.TabIndex = 3;
            this.txtDvt.UserTextLength  = QMVnSoft.AppInstance.TextControlLength.None;
            this.txtDvt.UserTrimMode  = QMVnSoft.AppInstance.TextControlTrimMode.Right;
            this.txtDvt.Value = ((object)(resources.GetObject("txtDvt.Value")));
            this.txtDvt.Validated += new System.EventHandler(this.txtDvt_Validated);
            // 
            // txtLo_Hang
            // 
            this.txtLo_Hang.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
            this.txtLo_Hang.CheckTextSearched = false;
            this.txtLo_Hang.DisabledForeColor = System.Drawing.Color.Blue;
            this.txtLo_Hang.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtLo_Hang.Location = new System.Drawing.Point(133, 154);
            this.txtLo_Hang.Name = "txtLo_Hang";
            this.txtLo_Hang.OldValue = null;
            this.txtLo_Hang.Size = new System.Drawing.Size(162, 20);
            this.txtLo_Hang.TabIndex = 7;
            this.txtLo_Hang.UserTextLength  = QMVnSoft.AppInstance.TextControlLength.None;
            this.txtLo_Hang.UserTrimMode  = QMVnSoft.AppInstance.TextControlTrimMode.Right;
            this.txtLo_Hang.Value = ((object)(resources.GetObject("txtLo_Hang.Value")));
            // 
            // lblHan_Dung
            // 
            this.lblHan_Dung.AutoSize = true;
            this.lblHan_Dung.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblHan_Dung.Location = new System.Drawing.Point(12, 178);
            this.lblHan_Dung.Name = "lblHan_Dung";
            this.lblHan_Dung.Size = new System.Drawing.Size(53, 14);
            this.lblHan_Dung.TabIndex = 1;
            this.lblHan_Dung.Text = "Hạn dùng";
            // 
            // txtHan_Dung
            // 
            this.txtHan_Dung.DateTimeFormat  = QMVnSoft.Controls.TextDate.DateTimeFormatType.Date;
            this.txtHan_Dung.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtHan_Dung.InsertKeyMode = System.Windows.Forms.InsertKeyMode.Overwrite;
            this.txtHan_Dung.Location = new System.Drawing.Point(133, 175);
            this.txtHan_Dung.Mask = "00/00/0000";
            this.txtHan_Dung.Name = "txtHan_Dung";
            this.txtHan_Dung.OldValue = null;
            this.txtHan_Dung.Size = new System.Drawing.Size(162, 20);
            this.txtHan_Dung.TabIndex = 8;
            this.txtHan_Dung.Value = ((object)(resources.GetObject("txtHan_Dung.Value")));
            // 
            // lblLo_Hang
            // 
            this.lblLo_Hang.AutoSize = true;
            this.lblLo_Hang.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblLo_Hang.Location = new System.Drawing.Point(12, 157);
            this.lblLo_Hang.Name = "lblLo_Hang";
            this.lblLo_Hang.Size = new System.Drawing.Size(46, 14);
            this.lblLo_Hang.TabIndex = 1;
            this.lblLo_Hang.Text = "Lô hàng";
            // 
            // txtDvt0
            // 
            this.txtDvt0.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.txtDvt0.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(194)))), ((int)(((byte)(217)))), ((int)(((byte)(247)))));
            this.txtDvt0.BorderStyle = System.Windows.Forms.BorderStyle.None;
            this.txtDvt0.CheckTextSearched = false;
            this.txtDvt0.DisabledForeColor = System.Drawing.Color.Blue;
            this.txtDvt0.Enabled = false;
            this.txtDvt0.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtDvt0.ForeColor = System.Drawing.Color.Blue;
            this.txtDvt0.Location = new System.Drawing.Point(301, 115);
            this.txtDvt0.Name = "txtDvt0";
            this.txtDvt0.OldValue = null;
            this.txtDvt0.Size = new System.Drawing.Size(111, 13);
            this.txtDvt0.TabIndex = 92;
            this.txtDvt0.UserTextLength  = QMVnSoft.AppInstance.TextControlLength.None;
            this.txtDvt0.UserTrimMode  = QMVnSoft.AppInstance.TextControlTrimMode.Right;
            this.txtDvt0.Value = ((object)(resources.GetObject("txtDvt0.Value")));
            // 
            // lblMa_Ke
            // 
            this.lblMa_Ke.AutoSize = true;
            this.lblMa_Ke.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblMa_Ke.Location = new System.Drawing.Point(12, 52);
            this.lblMa_Ke.Name = "lblMa_Ke";
            this.lblMa_Ke.Size = new System.Drawing.Size(47, 14);
            this.lblMa_Ke.TabIndex = 77;
            this.lblMa_Ke.Text = "Kệ hàng";
            // 
            // txtMa_Ke
            // 
            this.txtMa_Ke.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
            this.txtMa_Ke.CheckTextSearched = false;
            this.txtMa_Ke.DisabledForeColor = System.Drawing.Color.Empty;
            this.txtMa_Ke.FieldDisplay = "Ten_Ke";
            this.txtMa_Ke.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtMa_Ke.Location = new System.Drawing.Point(133, 49);
            this.txtMa_Ke.MaxLength = 32;
            this.txtMa_Ke.Name = "txtMa_Ke";
            this.txtMa_Ke.OldValue = null;
            this.txtMa_Ke.Size = new System.Drawing.Size(162, 20);
            this.txtMa_Ke.TabIndex = 1;
            this.txtMa_Ke.TableName = "DMKE";
            this.txtMa_Ke.TextDisplay = this.txtTen_Ke;
            this.txtMa_Ke.UserTextLength  = QMVnSoft.AppInstance.TextControlLength.ItemCode;
            this.txtMa_Ke.UserTrimMode  = QMVnSoft.AppInstance.TextControlTrimMode.All;
            this.txtMa_Ke.Value = ((object)(resources.GetObject("txtMa_Ke.Value")));
            this.txtMa_Ke.Validated += new System.EventHandler(this.txtMa_Vt_Validated);
            // 
            // txtTen_Ke
            // 
            this.txtTen_Ke.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.txtTen_Ke.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(194)))), ((int)(((byte)(217)))), ((int)(((byte)(247)))));
            this.txtTen_Ke.BorderStyle = System.Windows.Forms.BorderStyle.None;
            this.txtTen_Ke.CheckTextSearched = false;
            this.txtTen_Ke.DisabledForeColor = System.Drawing.Color.Blue;
            this.txtTen_Ke.Enabled = false;
            this.txtTen_Ke.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtTen_Ke.ForeColor = System.Drawing.Color.Blue;
            this.txtTen_Ke.Location = new System.Drawing.Point(301, 52);
            this.txtTen_Ke.Name = "txtTen_Ke";
            this.txtTen_Ke.OldValue = null;
            this.txtTen_Ke.Size = new System.Drawing.Size(287, 13);
            this.txtTen_Ke.TabIndex = 79;
            this.txtTen_Ke.UserTextLength  = QMVnSoft.AppInstance.TextControlLength.None;
            this.txtTen_Ke.UserTrimMode  = QMVnSoft.AppInstance.TextControlTrimMode.Right;
            this.txtTen_Ke.Value = ((object)(resources.GetObject("txtTen_Ke.Value")));
            // 
            // FormCDKHOEditor
            // 
            this.AddTitleText = "Thêm tồn kho đầu kỳ thực tế";
            this.ClientSize = new System.Drawing.Size(600, 208);
            this.Controls.Add(this.txtDvt0);
            this.Controls.Add(this.txtDvt);
            this.Controls.Add(this.txtLo_Hang);
            this.Controls.Add(this.txtSo_Luong);
            this.Controls.Add(this.txtDo_Con_PT);
            this.Controls.Add(this.txtDo_Am_PT);
            this.Controls.Add(this.txtH_Luong);
            this.Controls.Add(this.txtSo_Luong9);
            this.Controls.Add(this.txtMa_Kho);
            this.Controls.Add(this.txtTen_Ke);
            this.Controls.Add(this.txtTen_Vt);
            this.Controls.Add(this.lblDo_Con_PT);
            this.Controls.Add(this.lblDvt);
            this.Controls.Add(this.lblDo_Am_PT);
            this.Controls.Add(this.lblH_Luong);
            this.Controls.Add(this.txtTen_Kho);
            this.Controls.Add(this.lblSo_Luong);
            this.Controls.Add(this.txtMa_Ke);
            this.Controls.Add(this.lblMa_Ke);
            this.Controls.Add(this.txtMa_Vt);
            this.Controls.Add(this.lblMa_Vt);
            this.Controls.Add(this.lblMa_Kho);
            this.Controls.Add(this.txtNgay_Ct);
            this.Controls.Add(this.lblNgay_Ct);
            this.Controls.Add(this.txtHan_Dung);
            this.Controls.Add(this.lblHan_Dung);
            this.Controls.Add(this.lblLo_Hang);
            this.EditTitleText = "Sửa tồn kho đầu kỳ thực tế";
            this.Name = "FormCDKHOEditor";
            this.Text = "Thêm tồn kho đầu kỳ thực tế";
            this.Controls.SetChildIndex(this.lblLo_Hang, 0);
            this.Controls.SetChildIndex(this.lblHan_Dung, 0);
            this.Controls.SetChildIndex(this.txtHan_Dung, 0);
            this.Controls.SetChildIndex(this.lblNgay_Ct, 0);
            this.Controls.SetChildIndex(this.txtNgay_Ct, 0);
            this.Controls.SetChildIndex(this.lblMa_Kho, 0);
            this.Controls.SetChildIndex(this.lblMa_Vt, 0);
            this.Controls.SetChildIndex(this.txtMa_Vt, 0);
            this.Controls.SetChildIndex(this.lblMa_Ke, 0);
            this.Controls.SetChildIndex(this.txtMa_Ke, 0);
            this.Controls.SetChildIndex(this.lblSo_Luong, 0);
            this.Controls.SetChildIndex(this.txtTen_Kho, 0);
            this.Controls.SetChildIndex(this.lblH_Luong, 0);
            this.Controls.SetChildIndex(this.lblDo_Am_PT, 0);
            this.Controls.SetChildIndex(this.lblDvt, 0);
            this.Controls.SetChildIndex(this.lblDo_Con_PT, 0);
            this.Controls.SetChildIndex(this.txtTen_Vt, 0);
            this.Controls.SetChildIndex(this.txtTen_Ke, 0);
            this.Controls.SetChildIndex(this.txtMa_Kho, 0);
            this.Controls.SetChildIndex(this.txtSo_Luong9, 0);
            this.Controls.SetChildIndex(this.txtH_Luong, 0);
            this.Controls.SetChildIndex(this.txtDo_Am_PT, 0);
            this.Controls.SetChildIndex(this.txtDo_Con_PT, 0);
            this.Controls.SetChildIndex(this.txtSo_Luong, 0);
            this.Controls.SetChildIndex(this.txtLo_Hang, 0);
            this.Controls.SetChildIndex(this.txtDvt, 0);
            this.Controls.SetChildIndex(this.txtDvt0, 0);
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        protected override void OnReset()
        {
            if (base.NewChecked)
            {
                this.txtNgay_Ct.Value = AppInstance.OpeningDateOfSubEnterprice.AddDays(-1.0);
                this.txtMa_Vt.Value = "";
                this.txtTen_Vt.Value = "";
                this.txtDvt.Value = "";
                this.txtDvt0.Value = "";
                this.txtSo_Luong9.Value = 0;
                this.txtSo_Luong.Value = 0;
                this.txtLo_Hang.Value = DBNull.Value;
                this.txtHan_Dung.Value = DBNull.Value;
                this.txtH_Luong.Value = 0;
                this.txtDo_Am_PT.Value = 0;
                this.txtDo_Con_PT.Value = 0;
            }
        }

        public override bool OnSave()
        {
            DataRow localCurrentRow;
            if (AppInstance.EndingDateOfSubEnterprice >= AppInstance.OpeningDateOfSubEnterprice)
            {
                MessageBox.Show("Đã khóa dữ liệu!", AppInstance.SoftwareName, MessageBoxButtons.OK, MessageBoxIcon.Hand);
                return false;
            }
            if (this.txtNgay_Ct.Value.Equals(DBNull.Value) || (((DateTime) this.txtNgay_Ct.Value) >= AppInstance.OpeningDateOfSubEnterprice))
            {
                MessageBox.Show("Chứng từ phải trước ngày: " + AppInstance.OpeningDateOfSubEnterprice.ToShortDateString(), AppInstance.SoftwareName, MessageBoxButtons.OK, MessageBoxIcon.Hand);
                return false;
            }
            if (string.IsNullOrEmpty(this.txtMa_Kho.Text))
            {
                MessageBox.Show("Chưa nhập mã kho!", AppInstance.SoftwareName, MessageBoxButtons.OK, MessageBoxIcon.Hand);
                return false;
            }
            if (string.IsNullOrEmpty(this.txtMa_Vt.Text))
            {
                MessageBox.Show("Chưa nhập mã vật tư, hàng hóa!", AppInstance.SoftwareName, MessageBoxButtons.OK, MessageBoxIcon.Hand);
                return false;
            }
            if (this.txtSo_Luong9.NumericValue == 0M)
            {
                MessageBox.Show("Chưa nhập số tồn kho đầu kỳ!", AppInstance.SoftwareName, MessageBoxButtons.OK, MessageBoxIcon.Hand);
                return false;
            }
            if (base.NewChecked)
            {
                localCurrentRow = base.LocalTable.NewRow();
                localCurrentRow["Ma_Dvcs"] = AppInstance.Subsidiary;
                localCurrentRow["Stt0"] = AppDataAccess.Cong_So_Tt(AppInstance.Subsidiary);
            }
            else
            {
                localCurrentRow = base.LocalCurrentRow;
            }
            base.SavedMasterOrder = localCurrentRow["Stt0"];
            localCurrentRow["Ngay_Ct"] = this.txtNgay_Ct.Value;
            localCurrentRow["Ma_Kho"] = this.txtMa_Kho.Value;
            localCurrentRow["Ten_Kho"] = this.txtTen_Kho.Value;
            localCurrentRow["Ma_Ke"] = this.txtMa_Ke.Value;
            localCurrentRow["Ten_Ke"] = this.txtTen_Ke.Value;
            localCurrentRow["Ma_Vt"] = this.txtMa_Vt.Value;
            localCurrentRow["Ten_Vt"] = this.txtTen_Vt.Value;
            localCurrentRow["Dvt"] = this.txtDvt.Value;
            localCurrentRow["Dvt0"] = this.txtDvt0.Value;
            localCurrentRow["So_Luong9"] = this.txtSo_Luong9.Value;
            localCurrentRow["So_Luong"] = this.txtSo_Luong.Value;
            localCurrentRow["Lo_Hang"] = this.txtLo_Hang.Value;
            localCurrentRow["Han_Dung"] = this.txtHan_Dung.Value;
            localCurrentRow["H_Luong"] = this.txtH_Luong.Value;
            localCurrentRow["Do_Am_PT"] = this.txtDo_Am_PT.Value;
            localCurrentRow["Do_Con_PT"] = this.txtDo_Con_PT.Value;
            new CDKHODataAccess().Save(base.NewChecked, localCurrentRow);
            if (base.NewChecked)
            {
                base.LocalTable.Rows.Add(localCurrentRow);
            }
            base.LocalCurrentRow = localCurrentRow;
            base.LocalTable.AcceptChanges();
            this.txtMa_Kho.Focus();
            return base.OnSave();
        }

        public override void OnShow()
        {
            this.txtNgay_Ct.Value = base.LocalCurrentRow["Ngay_Ct"];
            this.txtMa_Kho.Value = base.LocalCurrentRow["Ma_Kho"];
            this.txtTen_Kho.Value = base.LocalCurrentRow["Ten_Kho"];
            this.txtMa_Ke.Value = base.LocalCurrentRow["Ma_Ke"];
            this.txtTen_Ke.Value = base.LocalCurrentRow["Ten_Ke"];
            this.txtMa_Vt.Value = base.LocalCurrentRow["Ma_Vt"];
            this.txtTen_Vt.Value = base.LocalCurrentRow["Ten_Vt"];
            this.txtDvt.Value = base.LocalCurrentRow["Dvt"];
            this.txtDvt0.Value = base.LocalCurrentRow["Dvt0"];
            this.txtSo_Luong9.Value = base.LocalCurrentRow["So_Luong9"];
            this.txtSo_Luong.Value = base.LocalCurrentRow["So_Luong"];
            this.txtLo_Hang.Value = base.LocalCurrentRow["Lo_Hang"];
            this.txtHan_Dung.Value = base.LocalCurrentRow["Han_Dung"];
            this.txtH_Luong.Value = base.LocalCurrentRow["H_Luong"];
            this.txtDo_Am_PT.Value = base.LocalCurrentRow["Do_Am_PT"];
            this.txtDo_Con_PT.Value = base.LocalCurrentRow["Do_Con_PT"];
        }

        private void SetItemRatio()
        {
            decimal fieldData = 0M;
            if (this.txtDvt.Value.Equals(this.txtMa_Vt.GetFieldData("Dvt")))
            {
                fieldData = 1M;
            }
            else if (this.txtDvt.Value.Equals(this.txtMa_Vt.GetFieldData("Dvt0")))
            {
                fieldData = (decimal) this.txtMa_Vt.GetFieldData("He_So0");
            }
            else if (this.txtDvt.Value.Equals(this.txtMa_Vt.GetFieldData("Dvt1")))
            {
                fieldData = (decimal) this.txtMa_Vt.GetFieldData("He_So1");
            }
            else if (this.txtDvt.Value.Equals(this.txtMa_Vt.GetFieldData("Dvt2")))
            {
                fieldData = (decimal) this.txtMa_Vt.GetFieldData("He_So2");
            }
            else if (this.txtDvt.Value.Equals(this.txtMa_Vt.GetFieldData("Dvt3")))
            {
                fieldData = (decimal) this.txtMa_Vt.GetFieldData("He_So3");
            }
            this.txtSo_Luong.Value = this.txtSo_Luong9.NumericValue * fieldData;
        }

        private void txtDvt_Validated(object sender, EventArgs e)
        {
            if (this.txtDvt.ValueChanged)
            {
                this.Calculate();
            }
        }

        private void txtMa_Vt_Validated(object sender, EventArgs e)
        {
            if (this.txtMa_Vt.ValueChanged)
            {
                this.txtDvt0.Value = this.txtMa_Vt.GetFieldData("Dvt");
                if (string.IsNullOrEmpty(this.txtMa_Vt.GetFieldData("Dvt0").ToString()))
                {
                    this.txtDvt.Value = this.txtMa_Vt.GetFieldData("Dvt");
                    this.txtDvt.ReadOnly = true;
                }
                else
                {
                    string str = (string.IsNullOrEmpty(this.txtMa_Vt.GetFieldData("Dvt").ToString()) ? "" : this.txtMa_Vt.GetFieldData("Dvt").ToString()) + (string.IsNullOrEmpty(this.txtMa_Vt.GetFieldData("Dvt0").ToString()) ? "" : ("," + this.txtMa_Vt.GetFieldData("Dvt0").ToString())) + (string.IsNullOrEmpty(this.txtMa_Vt.GetFieldData("Dvt1").ToString()) ? "" : ("," + this.txtMa_Vt.GetFieldData("Dvt1").ToString())) + (string.IsNullOrEmpty(this.txtMa_Vt.GetFieldData("Dvt2").ToString()) ? "" : ("," + this.txtMa_Vt.GetFieldData("Dvt2").ToString())) + (string.IsNullOrEmpty(this.txtMa_Vt.GetFieldData("Dvt3").ToString()) ? "" : ("," + this.txtMa_Vt.GetFieldData("Dvt3").ToString()));
                    this.txtDvt.InputMask = str;
                    this.txtDvt.ReadOnly = false;
                }
            }
        }

        private void txtSo_Luong9_Validated(object sender, EventArgs e)
        {
            if (this.txtSo_Luong9.ValueChanged)
            {
                this.Calculate();
            }
        }
    }
}

